#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;
/*
 * ShellCommand.h
 *
 *  Created on: Apr 27, 2011
 *      Author: user
 */

#ifndef SHELLCOMMAND_H_
#define SHELLCOMMAND_H_

class ShellCommand {
private:
	FILE* fpipe;
	char buffer[1024];

	void readPipe();
public:
	ShellCommand(string& cmd);
	bool startExecution();
	string getOutput();

	bool hasOutput;

	int exitStatus;

	string cmd_name;

	virtual ~ShellCommand();
};

void printOutput(ShellCommand& cmd);

void printCmd(ShellCommand& cmd);
void printResult(ShellCommand& cmd);

ShellCommand exec(string & str);

#endif /* SHELLCOMMAND_H_ */
